from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    app_name: str = "mall-iamyuan"
    app_version: str = "1.0.0"
    debug: bool = True

    # Database
    database_host: str = "192.168.8.128"
    database_port: int = 3306
    database_user: str = "root"
    database_password: str = "123456"
    database_name: str = "xq_mall"

    @property
    def database_url(self) -> str:
        return f"mysql+pymysql://{self.database_user}:{self.database_password}@{self.database_host}:{self.database_port}/{self.database_name}"

    # Security
    secret_key: str = "your-secret-key-here"
    algorithm: str = "HS256"
    access_token_expire_minutes: int = 30

    # Alipay
    alipay_app_id: str = ""
    alipay_private_key: str = ""
    alipay_public_key: str = ""
    alipay_sandbox: bool = True

    class Config:
        env_file = ".env"


settings = Settings()